/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package afroschool.beans;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author AUTRES
 */
@Entity
@Table(name = "cours")
@NamedQueries({@NamedQuery(name = "Cours.findByIdCours", query = "SELECT c FROM Cours c WHERE c.idCours = :idCours"), @NamedQuery(name = "Cours.findByCodeCours", query = "SELECT c FROM Cours c WHERE c.codeCours = :codeCours"), @NamedQuery(name = "Cours.findByIntitule", query = "SELECT c FROM Cours c WHERE c.intitule = :intitule")})
public class Cours implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "idCours", nullable = false)
    private Integer idCours;
    @Column(name = "codeCours")
    private String codeCours;
    @Column(name = "intitule")
    private String intitule;

    public Cours() {
    }

    public Cours(Integer idCours) {
        this.idCours = idCours;
    }

    public Integer getIdCours() {
        return idCours;
    }

    public void setIdCours(Integer idCours) {
        Integer oldIdCours = this.idCours;
        this.idCours = idCours;
        changeSupport.firePropertyChange("idCours", oldIdCours, idCours);
    }

    public String getCodeCours() {
        return codeCours;
    }

    public void setCodeCours(String codeCours) {
        String oldCodeCours = this.codeCours;
        this.codeCours = codeCours;
        changeSupport.firePropertyChange("codeCours", oldCodeCours, codeCours);
    }

    public String getIntitule() {
        return intitule;
    }

    public void setIntitule(String intitule) {
        String oldIntitule = this.intitule;
        this.intitule = intitule;
        changeSupport.firePropertyChange("intitule", oldIntitule, intitule);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCours != null ? idCours.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cours)) {
            return false;
        }
        Cours other = (Cours) object;
        if ((this.idCours == null && other.idCours != null) || (this.idCours != null && !this.idCours.equals(other.idCours))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "afroschool.beans.Cours[idCours=" + idCours + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
